Add Marshalling support for WIT-SVID keys#7134
Open
sorindumitru wants to merge 3 commits into
Open
Conversation
Signed-off-by: Sorin Dumitru <sorin@returnze.ro>
There was a problem hiding this comment.
Pull request overview
This PR extends pkg/common/bundleutil JWKS marshalling to include WIT-SVID signing keys (as use: "wit-svid"), adds an option to omit them, and introduces convenience helpers for producing X509/JWT/WIT-specific bundle outputs.
Changes:
- Add a new JWKS
usevalue ("wit-svid") and marshal WIT authorities into the bundle output. - Add
NoWITSVIDKeys()marshal option to optionally omit WIT keys. - Add
MarshalX509SVIDBundle,MarshalJWTSVIDBundle, andMarshalWITSVIDBundlehelpers, with accompanying unit tests.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/common/bundleutil/types.go | Adds the wit-svid use constant for JWKS entries. |
| pkg/common/bundleutil/marshal.go | Adds WIT key marshalling, a NoWITSVIDKeys option, and new targeted marshal helper functions. |
| pkg/common/bundleutil/marshal_test.go | Extends marshalling tests to cover WIT keys and the new helper functions. |
Comment on lines
+149
to
+156
| if !c.noWITSVIDKeys { | ||
| for keyID, witSigningKey := range bundle.WITAuthorities() { | ||
| jwks.Keys = append(jwks.Keys, jose.JSONWebKey{ | ||
| Key: witSigningKey, | ||
| KeyID: keyID, | ||
| Use: maybeUse(witSVIDUse), | ||
| }) | ||
| } |
Comment on lines
+89
to
+96
| func MarshalWITSVIDBundle(bundle *spiffebundle.Bundle, opts ...MarshalOption) (string, error) { | ||
| allOpts := append([]MarshalOption{NoX509SVIDKeys(), NoJWTSVIDKeys()}, opts...) | ||
| marshaledBundle, err := Marshal(bundle, allOpts...) | ||
| if err != nil { | ||
| return "", err | ||
| } | ||
| return string(marshaledBundle), nil | ||
| } |
Member
Author
There was a problem hiding this comment.
I think this decision was made for us by go-spiffe already. I don't think we can fix it there now, since it would be a breaking API change.
Signed-off-by: Sorin Dumitru <sorin@returnze.ro>
Signed-off-by: Sorin Dumitru <sorin@returnze.ro>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.